﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnvDTE;
using VSOLE = Microsoft.VisualStudio.OLE.Interop;

namespace Expect.VisualStudio.Extensions.Generator
{
    using System.CodeDom.Compiler;
    using System.IO;
    using System.Runtime.InteropServices;

    using Expect.Core.CodeGen;

    [ComVisible(true)]
    [Guid("B1242B0D-2824-4149-9B07-FD8C1FABF876")]
    public class ReportMetadataGenerator : BaseCodeGeneratorWithSite, VSOLE.IObjectWithSite
    {
        public const string _basefileExtension = ".reportdata";

        protected override string GetDefaultExtension()
        {
            CodeDomProvider provider = GetCodeProvider();

            return _basefileExtension + "." + provider.FileExtension;
        }

        protected override string GenerateCode(string inputFileContent)
        {
            CodeDomProvider provider = GetCodeProvider();
            var nfo = GetGenerationInfos(CurrentProject, GetCodeProvider());

            return Core.CodeGen.ReportMetadataGenerator.Execute(nfo, nfo.ParentName, inputFileContent);
        }        
    }
}
